package com.yh.workbill.ui.home.mvp;

import com.yh.workbill.base.IBaseModel;
import com.yh.workbill.model.WorkBill;
import com.yh.workbill.network.BaseCallback;
import com.yh.workbill.network.OkHttpService;

import java.util.List;

public class Home_Model {
    interface HomeCallback extends IBaseModel.Fail {
        void successWorkBillData(List<WorkBill> data);
    }

    public void getWorkBillData(String user_uuid, int pageindex, int pagenumber, HomeCallback callback) {
        OkHttpService.getInstance().getWorkBill(user_uuid, pageindex, pagenumber, new BaseCallback<List<WorkBill>>() {

            @Override
            public void accessSuccess(int code, String msg, List<WorkBill> data) {
                if (code == 200) {
                    callback.successWorkBillData(data);
                } else {
                    callback.fail(msg);
                }
            }

            @Override
            public void accessFailure(String errorMessage) {
                callback.fail(errorMessage);
            }
        });
    }

}
